package acwing._1_1AlgorithmBasic._3SearchGraph;
/**
 * @Project : AlgorithmLearning
 * @Package : ACWing._1_1AlgorithmBasic._3SearchGraph
 * @File : Q0860.java
 * @Author : WangRuoyu
 * @Date : 2023/4/3 14:58
 */

import java.io.*;
import java.util.Arrays;

public class Q0860 {
    static void add(int a, int b, int[] h, int[] e, int[] next, int idx) {
        e[idx] = b;
        next[idx] = h[a];
        h[a] = idx;
    }

    static boolean dfs(int u, int color, int st[], int[] h, int[] e, int[] next) {
        st[u] = color;
        for (int i = h[u]; i != -1; i = next[i]) {
            int j = e[i];
            if (st[j] == 0) { // 如果没染色就染色
                if (!dfs(j, -color, st, h, e, next)) return false;
            } else if (st[j] == color) { // 如果染过色就看颜色是否一致
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String[] words = br.readLine().split(" ");
        int n = Integer.parseInt(words[0]);
        int m = Integer.parseInt(words[1]);

        int[] h = new int[n + 1];
        int[] st = new int[n + 1];
        int[] e = new int[2 * m + 10];
        int[] next = new int[2 * m + 10];
        int idx = 0;
        Arrays.fill(h, -1);

        for (int i = 0; i < m; ++i) {
            words = br.readLine().split(" ");
            int a = Integer.parseInt(words[0]);
            int b = Integer.parseInt(words[1]);
            if (a == b) {
                System.out.println("No");
                return;
            }
            add(a, b, h, e, next, idx);
            idx++;
            add(b, a, h, e, next, idx);
            idx++;
        }

        for (int i = 0; i < n; ++i) {
            if (st[i] == 0) {
                boolean flag = dfs(i, 1, st, h, e, next);
                if (!flag) {
                    System.out.println("No");
                    return;
                }
            }
        }
        System.out.println("Yes");
    }
}

